The Sound Description Structure
A sound description structure contains information that defines the characteristics of one or more sound samples. Data in the sound description structure indicates the type of compression that was used, the sample size, the rate at which samples were obtained, and so on. Sound media handlers use the information in the sound description structure when they process the sound samples.
See the chapter "Image Compression Manager" for a description of the image description structure, which contains information that defines the characteristics of an image.
The
SoundDescription
data type defines the layout of a sound description structure. See
"Media Functions,"
which begins on
Media Functions
, for more information about sound media handlers.
struct SoundDescription
{
long descSize; /* number of bytes in this structure */
long dataFormat; /* format of the sound data */
long resvd1; /* reserved--set to 0 */
short resvd2; /* reserved--set to 0 */
short dataRefIndex; /* reserved--set to 1 */
short version; /* reserved--set to 0 */
short revlevel; /* reserved--set to 0 */
long vendor; /* reserved--set to 0 */
short numChannels; /* number of channels used by sample */
short sampleSize; /* number of bits in each sample */
short compressionID; /* reserved--set to 0 */
short packetSize; /* reserved--set to 0 */
Fixed sampleRate; /* rate at which samples were obtained */
};
-
descSize
-
Defines the total size, in bytes, of this sound description structure.
-
dataFormat
-
Describes the format of the sound data. Possible values include:
|
'raw '
|
Sound samples are stored uncompressed, in offset-binary format (that is, sample data values range from 0 to 255).
|
|
'twos'
|
Sound samples are stored uncompressed, in twos-complement format (that is, sample data values range from -128 to 127). The Sound Manager uses this format when it creates sound files in Audio Interchange File Format (AIFF).
|
|
'MAC3'
|
Sound samples have been compressed by the Sound Manager at a ratio of 3:1.
|
|
'MAC6'
|
Sound samples have been compressed by the Sound Manager at a ratio of 6:1.
|
-
Some older movie files sometimes have a zero value in this field. You should assume that this is the same as the
'raw '
value.
-
resvd1
-
Reserved for Apple. Set this field to 0 in any sound description structures you create.
-
resvd2
-
Reserved for Apple. Set this field to 0 in any sound description structures you create.
-
dataRefIndex
-
Reserved for Apple. Set this field to 0 in any sound description structures you create.
-
version
-
Reserved for Apple. Set this field to 0 in any sound description structures you create.
-
revLevel
-
Reserved for Apple. Set this field to 0 in any sound description structures you create.
-
vendor
-
Reserved for Apple. Set this field to 0 in any sound description structures you create.
-
numChannels
-
Indicates the number of sound channels used by the sound sample. Set this field to 1 for monaural sounds; set it to 2 for stereo sounds.
-
sampleSize
-
Specifies the number of bits in each sound sample. Set this field to 8 for 8-bit sound; set it to 16 for 16-bit sound.
-
compressionID
-
Reserved for Apple. Set this field to 0 in any sound description structures you create.
-
packetSize
-
Reserved for Apple. Set this field to 0 in any sound description structures you create.
-
sampleRate
-
Indicates the rate at which the sound samples were obtained. Sound media handlers use this value to influence the natural playback speed of the sound described by this sound description structure. This field contains an unsigned, fixed-point number that specifies the number of samples collected per second. Some common values include:
|
0x15BBA2E8
|
Specifies a sample rate of 5563.6363 samples per second.
|
|
0x1CFA2E8B
|
Specifies a sample rate of 7418.1818 samples per second.
|
|
0x2B7745D1
|
Specifies a sample rate of 11127.2727 samples per second.
|
|
0x56EE8BA3
|
Specifies a sample rate of 22254.5454 samples per second.
|
|
0xAC440000
|
Specifies a sample rate of 44100.0000 samples per second.
|
© 1997 Apple Computer, Inc.Previous | Chapter Top | Chapter Contents | Next